<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:pe="http://primefaces.org/ui/extensions">
    <h:head>
        <title>#{bundle.savtrx}</title>
        <link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
    </h:head>
    <h:body>
        <ui:composition >
            <h:form>
               
               <script type="text/javascript">  
                    function handleSavtrxApprov(xhr, status, args) {  
                        if(args.validationFailed || !args.success) {  
                            jQuery('#dialog').effect("shake", { times:3 }, 100);  
                        } else {  
                           dlgsavtrx.hide();  
                        }  
                    }
                </script>  
                
                 <p:toolbar >
                    <p:toolbarGroup align="left">
                        
                        <p:commandButton value="#{bundle.btnOpen}" icon="ui-icon-disk" 
                                        update=":#{utilityBean.findClientId('displaysavtrx')}" actionListener="#{savtrxApprovalBean.openData()}"
                                        rendered="#{menuBean.cekButtonAccess(104,'APP;')}"
                                        oncomplete="dlgsavtrx.show();"> 
                        </p:commandButton>
                            
                        <p:commandButton value="Refresh" icon="ui-icon-arrowrefresh-1-w" update=":#{utilityBean.findClientId('dtsavtrx')}" 
                                         actionListener="#{savtrxApprovalBean.loadSavtrxs()}" >
                        </p:commandButton>
                    </p:toolbarGroup>
                </p:toolbar>

                <p:dataTable id="dtsavtrx" value="#{savtrxApprovalBean.savtrxs}" var="savtrxapprove" 
                    selection="#{savtrxApprovalBean.savtrx}" selectionMode="single" rowKey="#{savtrxapprove.savtrxId}" 
                    rowIndexVar="noUrut" emptyMessage=""
                    paginator="true" rows="10" paginatorPosition="bottom" 
                    paginatorTemplate="{CurrentPageReport} {PreviousPageLink} {NextPageLink}"
                    resizableColumns="true">
                                        
                    <p:column style="width: 10px">
                        <f:facet name="header">No.</f:facet>
                        <h:outputText value="#{noUrut+1}" />
                    </p:column>
                    
                    <p:column style="width: 90px">
                        <f:facet name="header">#{bundle.sourceAccount}</f:facet>
                        <h:outputText value="#{savtrxapprove.saving.accountNo}" />
                    </p:column>

                    <p:column style="width: 90px" >
                        <f:facet name="header">#{bundle.cif}</f:facet>
                        <h:outputText value="#{savtrxapprove.saving.customer.cif}" />
                    </p:column>
                                        
                    <p:column style="width: 130px" >
                        <f:facet name="header">#{bundle.customer}</f:facet>
                        <h:outputText value="#{savtrxapprove.saving.customer.customerName}" />
                    </p:column>
                                        
                    <p:column style="width: 80px" >
                        <f:facet name="header">#{bundle.date}</f:facet>
                        <h:outputText value="#{savtrxapprove.transDate}" />
                    </p:column>
                    
                    <p:column style="width: 130px" >
                        <f:facet name="header">#{bundle.amount}</f:facet>
                        <h:outputText value="#{savtrxapprove.amount}" styleClass="numPos">
                            <f:convertNumber groupingUsed="true" />
                        </h:outputText>
                    </p:column>
                </p:dataTable>
            </h:form>
            
            <p:dialog header="Verifikasi Transfer Simpanan" widgetVar="dlgsavtrx" closable="true" dynamic="true" 
                           appendToBody="true" modal="true" >
                <p:ajax event="close" listener="#{savtrxApprovalBean.handleClose}"/>
                <h:form>
                    <h:panelGrid style="vertical-align: top" id="displaysavtrx" 
                                cellpadding="" columns="3" 
                                columnClasses="panelGridId,panelGridId,panelGridId" >
                        <p:panel header="#{bundle.savtrx}">
                            <h:panelGrid columns="3" cellspacing="10" cellpadding="0">
                                <h:outputLabel value= "#{bundle.trxNum}" /><h:outputLabel value=":"/>
                                <h:outputText value="#{savtrxApprovalBean.savtrx.transferNo}" id="savtrxTransferNo" />

                                <h:outputLabel value= "#{bundle.date}" /><h:outputLabel value=":"/>
                                <h:outputText value="#{savtrxApprovalBean.savtrx.transDate}" id="savtrxdate" />

                                <h:outputLabel value= "#{bundle.fromAccnt}" /><h:outputLabel value=":"/>
                                <h:outputText value="#{savtrxApprovalBean.savtrx.saving.accountNo}" />

                                <h:outputLabel value= "#{bundle.toAccnt}" /><h:outputLabel value=":"/>
                                <h:outputText value="#{savtrxApprovalBean.accntDest}" />

                                <h:outputLabel value= "#{bundle.amount}" /><h:outputLabel value=":"/>
                                <h:outputText styleClass="numPos" value="#{savtrxApprovalBean.savtrx.amount}" >
                                    <f:convertNumber groupingUsed="true" />
                                </h:outputText>
                            </h:panelGrid>
                        </p:panel>

                        <p:panel header="#{bundle.sourceAccount}" style="margin: 0 0 0 0;">
                            <h:panelGrid columns="3" border="0" cellpadding="0" cellspacing="10">
                                <h:outputLabel value= "#{bundle.savingNo}" /><h:outputLabel value= ":" />
                                <h:outputLabel value="#{savtrxApprovalBean.savtrx.saving.accountNo}" />

                                <h:outputLabel value="#{bundle.savprod}"/><h:outputLabel value= ":" />
                                <h:outputLabel value="#{savtrxApprovalBean.savtrx.saving.savprod.productName}" />

                                <h:outputLabel value= "#{bundle.cif}" /><h:outputLabel value= ":" />
                                <h:outputLabel value="#{savtrxApprovalBean.savtrx.saving.customer.cif}" />

                                <h:outputLabel value= "#{bundle.globalName}" /><h:outputLabel value= ":" />
                                <h:outputText value="#{savtrxApprovalBean.savtrx.saving.customer.customerName}" />

                                <h:outputLabel value= "#{bundle.savprod}" /><h:outputLabel value= ":" />
                                <h:outputText rendered="true" value="#{savtrxApprovalBean.savtrx.saving.savprod.productName}" />

                                <h:outputLabel value= "#{bundle.saldoAwal}" /><h:outputLabel value= ":" />
                                <h:outputText styleClass="numPos" value="#{savtrxApprovalBean.savtrx.saving.balance}" >
                                    <f:convertNumber groupingUsed="true" />
                                </h:outputText>

                                <h:outputLabel value= "#{bundle.balance}" /><h:outputLabel value= ":" />
                                <h:outputText styleClass="numPos" value="#{savtrxApprovalBean.balanceSrc}" >
                                    <f:convertNumber groupingUsed="true" />
                                </h:outputText>

                            </h:panelGrid>
                        </p:panel>

                        <p:panel header="#{bundle.destAccount}" style="margin: 0 0 0 0;">
                            <h:panelGrid columns="3" border="0" cellpadding="0" cellspacing="10">
                                <h:outputLabel value= "#{bundle.savingNo}" /><h:outputLabel value= ":" />
                                <h:outputLabel value="#{savtrxApprovalBean.savdest.accountNo}" />

                                <h:outputLabel value="#{bundle.savprod}"/><h:outputLabel value= ":" />
                                <h:outputLabel value="#{savtrxApprovalBean.savdest.savprod.productName}" />

                                <h:outputLabel value= "#{bundle.cif}" /><h:outputLabel value= ":" />
                                <h:outputLabel value="#{savtrxApprovalBean.savdest.customer.cif}" />

                                <h:outputLabel value= "#{bundle.globalName}" /><h:outputLabel value= ":" />
                                <h:outputText value="#{savtrxApprovalBean.savdest.customer.customerName}" />

                                <h:outputLabel value= "#{bundle.savprod}" /><h:outputLabel value= ":" />
                                <h:outputText rendered="true" value="#{savtrxApprovalBean.savdest.savprod.productName}" />

                                <h:outputLabel value= "#{bundle.saldoAwal}" /><h:outputLabel value= ":" />
                                <h:outputText styleClass="numPos" value="#{savtrxApprovalBean.savdest.balance}" >
                                    <f:convertNumber groupingUsed="true" />
                                </h:outputText>

                                <h:outputLabel value= "#{bundle.balance}" /><h:outputLabel value= ":" />
                                <h:outputText styleClass="numPos" value="#{savtrxApprovalBean.balanceDest}">
                                    <f:convertNumber groupingUsed="true" />
                                </h:outputText>

                            </h:panelGrid>
                        </p:panel>
                    </h:panelGrid>
                    
                    <h:panelGrid cellpadding="0" styleClass="pComBtnSTDR">
                        <f:facet name="footer">  
                            <p:commandButton value="#{bundle.approved}" icon="ui-icon-disk" actionListener="#{savtrxApprovalBean.approve()}"
                                             update=":#{utilityBean.findClientId('dtsavtrx')}" disabled="#{savtrxApprovalBean.savtrx == null}"      
                                             rendered="#{menuBean.cekButtonAccess(104,'APP;')}"
                                oncomplete="dlgsavtrx.hide();"/>  
                            <p:commandButton value="#{bundle.btnClose}" oncomplete="dlgsavtrx.hide()" 
                                icon="ui-icon-document" />
                        </f:facet>
                    </h:panelGrid>
                </h:form>        
            </p:dialog>
            
        </ui:composition> 
    </h:body>
</html>

